#include "Multigrid/MGFactory.h"
#include "Multigrid/TestMultigrid.h"

using namespace std;
using iVec = Vec<int,1>;
using rVec = Vec<Real,1>;

template <class T>
using Vector = std::vector<T>;

int main(int argc, char* argv[]){
  string name = argv[1];
  string file = "../../test/"+name+".json";
  const int num = 3;
  cout << "FMV-cycle test:" << endl;
  cout << "--------------------------- Test function F = \\sin(\\pi x) ---------------------------" << endl;
  D1Func1 f1;
  cout << "----------------Injection+LinearInterpolation----------------" << endl;
  MGFactory<1,Injection<1>,LinearInterpolation<1>> MGF1(file);
  TestMultigrid<1,Injection<1>,LinearInterpolation<1>> TM1(MGF1);
  TM1.TestFMVCycle(f1,num);

  cout << "----------------FullWeightingRestriction+LinearInterpolation----------------" << endl;
  MGFactory<1,FullWeightingRestriction<1>,LinearInterpolation<1>> MGF2(file);
  TestMultigrid<1,FullWeightingRestriction<1>,LinearInterpolation<1>> TM2(MGF2);
  TM2.TestFMVCycle(f1,num);

  cout << "----------------Injection+QuadraticInterpolation----------------" << endl;
  MGFactory<1,Injection<1>,QuadraticInterpolation<1>> MGF3(file);
  TestMultigrid<1,Injection<1>,QuadraticInterpolation<1>> TM3(MGF3);
  TM3.TestFMVCycle(f1,num);

  cout << "----------------FullWeightingRestriction+QuadraticInterpolation----------------" << endl;
  MGFactory<1,FullWeightingRestriction<1>,QuadraticInterpolation<1>> MGF4(file);
  TestMultigrid<1,FullWeightingRestriction<1>,QuadraticInterpolation<1>> TM4(MGF4);
  TM4.TestFMVCycle(f1,num);


  cout << "--------------------------- Test function F = \\exp(x) ---------------------------" << endl;
  D1Func2 f2;
  cout << "----------------Injection+LinearInterpolation----------------" << endl;
  TM1.TestFMVCycle(f2,num);

  cout << "----------------FullWeightingRestriction+LinearInterpolation----------------" << endl;
  TM2.TestFMVCycle(f2,num);

  cout << "----------------Injection+QuadraticInterpolation----------------" << endl;
  TM3.TestFMVCycle(f2,num);

  cout << "----------------FullWeightingRestriction+QuadraticInterpolation----------------" << endl;
  TM4.TestFMVCycle(f2,num);
}
